/*******************************************************************************************************

Table A12: Difference-in-differences estimates: alternative definitions of the control
groups.

*******************************************************************************************************/


*Set directory path
cd "C:\Users\tsa23\Documents\petitions\replication files"

clear all

*read in our main dataset
use dta/did_rep.dta

*Elminate contrituencies which are not part of case G
drop if ID == 45 //University of Cambridge
drop if ID == 191 //University of Oxford

egen mean_ID_pop = mean(cond(inrange(year, 1830, 1831), pop_i, .)), by(ID )

gen large =0
replace large = 1 if new == 0 & sch_A!=1 &  sch_B!=1 & drummond==. & mean_ID_pop>10000 
keep if new==1 | large==1

gen treatgroup = 0
replace treatgroup =  1 if new==1 

gen treatinter = treatperiod*treatgroup

drop if year==1830 | year==1831 | year==1832

collapse ln_petitions treatgroup large, by(ID treatperiod treatinter)

label var treatinter "T * A" 
label var treatgroup "T"
label var treatperiod "A"
label var ln_petitions "Log all petitions"

reg ln_petitions treatinter treatgroup treatperiod, cl(ID)
outreg2 treatinter treatgroup treatperiod using results\tableA12, nocons replace addt(Constituencies, 89, Treatment, G1) asterisk(coef) auto(2) label ctitle(Log (petitions + 1)) keep(treatinter treatgroup treatperiod) se  symbol(**,*,+) tex(frag)

clear all

*read in our main dataset
use dta/did_rep.dta

*Elminate contrituencies which are not part of case L1 (Sch A, B, original A or B but saved)
drop if ID == 45 //University of Cambridge
drop if ID == 191 //University of Oxford
keep if sch_A==1 | sch_B == 1 | sch_A_org == 1 | sch_B_org == 1

gen treatgroup = 0
replace treatgroup =  1 if sch_A==1 

gen treatinter = treatperiod*treatgroup

drop if year==1830 | year==1831 | year==1832

collapse ln_petitions treatgroup sch_A, by(ID treatperiod treatinter)

label var treatinter "T * A" 
label var treatgroup "T"
label var treatperiod "A"
label var ln_petitions "Log all petitions"

reg ln_petitions treatinter treatgroup treatperiod, cl(ID)
outreg2 treatinter treatgroup treatperiod using results\tableA12, nocons append addt(Constituencies, 110, Treatment, L1) asterisk(coef) auto(2) label ctitle(Log (petitions + 1)) keep(treatinter treatgroup treatperiod) se  symbol(**,*,+) tex(frag)



